<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->string("title")->comment('标题');
            $table->mediumText('body')->comment('内容');
            $table->integer('user_id')->comment('用户id');
            $table->integer('column_id')->comment('专栏id');
            $table->integer('view')->comment('浏览次数')->default(0);
            $table->integer('like')->comment('点赞次数')->default(0);
            $table->integer('hot')->comment('文章热度')->default(0);
            $table->tinyInteger('status')->comment('文章状态')->default(1);
            $table->string('img_path')->comment('封面图片地址')->default('')->nullable();
            $table->softDeletes()->comment('软删除');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('posts');
    }
}
